package top.scauwlt.config;

import lombok.*;

/**
 * @Author wmm
 * @Date 2022/7/25 16:28
 */
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Builder
@ToString
public class RpcServiceConfig {
    /**
     * service version
     */
    private String version = "";
    /**
     * service group: 同个接口多中实现时可用group区分
     */
    private String group = "";
    /**
     * 目标对象
     */
    private Object service;

    public String getRpcServiceName() {
        return this.getServiceName() + this.getGroup() + this.getVersion();
    }

    public String getServiceName() {
        return this.service.getClass().getInterfaces()[0].getCanonicalName();
    }
}
